import request from '@/utils/request'
// 获取角色列表
export const roleListAPI = (query) => {
  return request({
    method: 'get',
    url: '/sys/role',
    params: query

  })
}
// 删除角色
export const delRoleAPI = (roleId) => {
  return request({
    method: 'delete',
    url: `/sys/role/${roleId}`
  })
}
// 新增角色
export const addRoleAPI = (roleForm) => {
  return request({
    method: 'post',
    url: '/sys/role',
    data: roleForm
  })
}
// 获取角色详情
export const roleDetailAPI = (roleId) => {
  return request({
    method: 'get',
    url: `/sys/role/${roleId}`
  })
}
// 修改角色详情
export const editRoleDetail = (roleForm) => {
  return request({
    method: 'put',
    url: `/sys/role/${roleForm.id}`,
    data: roleForm
  })
}
// 获取公司详情
export const getCompanyDetailAPI = (companyId) => {
  return request({
    method: 'get',
    url: `/company/${companyId}`
  })
}
// 给角色分配权限
export const assignPermAPI = (id, permIds) => {
  return request({
    method: 'put',
    url: `/sys/role/assignPrem`,
    data: {
      id,
      permIds
    }
  })
}
